// https://umijs.org/config/
import { defineConfig } from 'umi';
import { join } from 'path';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
const { REACT_APP_ENV } = process.env;
const proxyConfig = proxy as any;
export default defineConfig({
  hash: true,
  antd: {},
  dva: {
    hmr: true,
  },
  layout: {
    // https://umijs.org/zh-CN/plugins/plugin-layout
    locale: true,
    siderWidth: 208,
    ...defaultSettings,
  },
  // https://umijs.org/zh-CN/plugins/plugin-locale
  dynamicImport: {
    loading: '@ant-design/pro-layout/es/PageLoading',
  },
  targets: {
    ie: 11,
  },
  // umi routes: https://umijs.org/docs/routing
  routes: [
    {
      path: '/user',
      layout: false,
      routes: [
        {
          path: '/user/login',
          layout: false,
          name: 'login',
          component: './user/Login',
        },
        {
          path: '/user',
          redirect: '/user/login',
        },
        {
          name: 'register-result',
          icon: 'smile',
          path: '/user/register-result',
          component: './user/register-result',
        },
        {
          name: 'register',
          icon: 'smile',
          path: '/user/register',
          component: './user/register',
        },
        {
          component: '404',
        },
      ],
    },
    {
      path: '/shop',
      name: '门店管理',
      icon: 'icon-mendianguanli1',
      routes: [
        // {
        //   name: '门店概况',
        //   icon: 'icon-tubiao-zhuzhuangtu',
        //   path: '/shop/overview/index',
        //   component: 'shop/overview/index',
        // },
        {
          name: '门店信息',
          icon: 'icon-mendianliebiao',
          path: '/shop/list/index',
          component: 'shop/list/index',
        },
        {
          name: '订单详情',
          icon: '',
          path: '/shop/orderDetail/index/:id',
          component: 'shop/orderDetail/index',
          //menuRender: false,
          hideInMenu: true,
        },
      ]
    },
    {
      path: '/orderInfo',
      name: '订单查询',
      icon: 'icon-a-dingdan1',
      routes: [
        {
          name: '订单列表',
          icon: 'icon-dingdanliebiao',
          path: '/orderInfo/order/index',
          component: 'orderInfo/order/index',
        },
        {
          name: '预定列表',
          icon: 'icon-duding',
          path: '/orderInfo/preOrder/index',
          component: 'orderInfo/preOrder/index',
        },
      ]
    },
    {
      path: '/board',
      name: '餐桌管理',
      icon: 'icon-canzhuo',
      routes: [
        {
          name: '餐桌列表',
          icon: 'icon-shangpinfenlei',
          path: '/board/index',
          component: 'board/index',
        },
      ]
    },
    {
      path: '/book',
      name: '订座管理',
      icon: 'icon-dingzuo',
      routes: [
        {
          name: '订座类型',
          icon: 'icon-shangpinfenlei',
          path: '/book/bookType/index',
          component: 'book/bookType/index',
        },
        {
          name: '桌位管理',
          icon: 'icon-zhuoweiguanli',
          path: '/book/boardArea/index',
          component: 'book/boardArea/index',
        },
        {
          name: '订座列表',
          icon: 'icon-dingdanliebiao',
          path: '/book/userBook/index',
          component: 'book/userBook/index',
        },
      ]
    },
    {
      path: '/goodAbout',
      name: '商品管理',
      icon: 'icon-shangpin',
      routes: [
        {
          name: '商品分类',
          icon: 'icon-shangpinfenlei',
          path: '/goodAbout/goodType/index',
          component: 'goodAbout/goodType/index',
        },
        {
          name: '商品列表',
          icon: 'icon-shangpinliebiao',
          path: '/goodAbout/good/index',
          component: 'goodAbout/good/index',
        },
      ]
    },

    // {
    //   path: '/system',
    //   name: '系统管理',
    //   icon: 'icon-xitong',
    //   routes: [
    //     {
    //       name: '用户管理',
    //       icon: 'icon-user',
    //       path: '/system/adminUser/index',
    //       component: 'system/adminUser/index',
    //     },
    //     {
    //       name: '角色管理',
    //       icon: 'icon-menu',
    //       path: '/system/adminRole/index',
    //       component: 'system/adminRole/index',
    //     },
    //     {
    //       name: '权限管理',
    //       icon: 'icon-authority',
    //       path: '/system/authority/index',
    //       component: 'system/authority/index',
    //     },
    //     {
    //       name: '字典管理',
    //       icon: 'icon-zidian',
    //       path: '/system/dictionary/index',
    //       component: 'system/dictionary/index',
    //     },
    //   ],
    // },
    // {
    //   path: '/content',
    //   name: '内容管理',
    //   icon: 'icon-content',
    //   routes: [
    //     {
    //       name: '文章管理',
    //       icon: 'icon-wenzhangguanli',
    //       path: '/content/adminArticle/index',
    //       component: 'content/adminArticle/index',
    //     },
    //     {
    //       name: '评论管理',
    //       icon: 'icon-pinglun',
    //       path: '/content/articleComment/index',
    //       component: 'content/articleComment/index',
    //     },
    //     {
    //       name: '轮播管理',
    //       icon: 'icon-lunbotuguanli',
    //       path: '/content/adminLb/index',
    //       component: 'content/adminLb/index',
    //     },
    //     {
    //       name: '友情链接',
    //       icon: 'icon-a-youqinglianjie1',
    //       path: '/content/friendlyLink/index',
    //       component: 'content/friendlyLink/index',
    //     },
    //     {
    //       name: '开发者导航',
    //       icon: 'icon-daohang',
    //       path: '/content/developerNavigation/index',
    //       component: 'content/developerNavigation/index',
    //     },
    //   ],
    // },
    // {
    //   path: '/customer',
    //   name: '客户管理',
    //   icon: 'icon-kehu',
    //   routes: [
    //     {
    //       name: '客户管理',
    //       icon: 'icon-user',
    //       path: '/customer/user/index',
    //       component: 'customer/user/index',
    //     },
    //   ],
    // },
    // {
    //   path: '/question',
    //   name: '答题管理',
    //   icon: 'icon-datixitongguanli',
    //   routes: [
    //     {
    //       name: '题库管理',
    //       icon: 'icon-dati1',
    //       path: '/customer/user/index',
    //       component: 'customer/user/index',
    //     },
    //   ],
    // },
    {
      path: '/basicSetting',
      name: '基础配置',
      icon: 'icon-jichupeizhi',
      routes: [
        {
          name: '运费设置',
          icon: 'icon-yunfeishezhi',
          path: '/basicSetting/moneySetting/index',
          component: 'basicSetting/moneySetting/index',
        },
        {
          name: '积分设置',
          icon: 'icon-jifenshezhi',
          path: '/basicSetting/integeralSetting/index',
          component: 'basicSetting/integeralSetting/index',
        }
      ]
    },
    {
      path: '/rule',
      name: '商品规格',
      icon: 'icon-shangpinguige',
      routes: [
        {
          name: '规格类别',
          icon: 'icon-leibie',
          path: '/rule/goodRule/index',
          component: 'rule/goodRule/index',
        }
        , {
          name: '规格管理',
          icon: 'icon-guigeguanli',
          path: '/rule/ruleDetail/index',
          component: 'rule/ruleDetail/index',
        },
      ]
    },
    {
      path: '/takeAway',
      name: '用户中心',
      icon: 'icon-kehu',
      routes: [
        {
          name: '用户管理',
          icon: 'icon-user',
          path: '/takeAway/user/index',
          component: 'takeAway/user/index',
        },
        {
          name: '地址管理',
          icon: 'icon-dizhi',
          path: '/takeAway/address/index',
          component: 'takeAway/address/index',
        },
      ],
    },
    {
      path: '/project',
      name: '项目列表',
      layout: false,
      icon: 'icon-coding',
      hideInMenu: true,
      routes: [
        {
          name: '项目列表',
          path: '/project/index',
          component: 'project/index',
          icon: 'icon-coding',
        },
      ],
    },
    // {
    //   path: '/generator',
    //   name: '快速开发',
    //   icon: 'icon-coding',
    //   routes: [
    //     {
    //       name: '代码生成',
    //       path: '/generator/index',
    //       component: 'generator/index',
    //       icon: 'icon-coding',
    //     },
    //   ],
    // },
    //  {
    //   path: '/form',
    //   name: '系统表单',
    //   //hideInMenu: true,
    //   icon: 'icon-biaodansheji',
    //   routes: [
    //     {
    //       name: '表单管理',
    //       icon: 'icon-biaodansheji-biao',
    //       path: '/form/formDesign/index',
    //       // 不展示菜单
    //       //menuRender: false,
    //       component: 'form/formDesign/index',
    //     },
    //     {
    //       name: '表单设计',
    //       icon: '',
    //       path: '/form/formDesign/design',
    //       component: 'form/formDesign/design',
    //       //menuRender: false,
    //       hideInMenu: true,
    //     },
    //     {
    //       name: '表单预览',
    //       icon: '',
    //       path: '/form/formDesign/formPreview/:id',
    //       component: 'form/formDesign/formPreview',
    //       //menuRender: false,
    //       hideInMenu: true,
    //     },
    //   ],
    // },
    // {
    //   path: '/dashboard',
    //   name: 'dashboard',
    //   icon: 'dashboard',
    //   routes: [
    //     {
    //       path: '/dashboard',
    //       redirect: '/dashboard/analysis',
    //     },
    //     {
    //       name: 'analysis',
    //       icon: 'smile',
    //       path: '/dashboard/analysis',
    //       component: './dashboard/analysis',
    //     },
    //     {
    //       name: 'monitor',
    //       icon: 'smile',
    //       path: '/dashboard/monitor',
    //       component: './dashboard/monitor',
    //     },
    //     {
    //       name: 'workplace',
    //       icon: 'smile',
    //       path: '/dashboard/workplace',
    //       component: './dashboard/workplace',
    //     },
    //   ],
    // },
    // {
    //   path: '/form',
    //   icon: 'form',
    //   name: 'form',
    //   routes: [
    //     {
    //       path: '/form',
    //       redirect: '/form/basic-form',
    //     },
    //     {
    //       name: 'basic-form',
    //       icon: 'smile',
    //       path: '/form/basic-form',
    //       component: './form/basic-form',
    //     },
    //     {
    //       name: 'step-form',
    //       icon: 'smile',
    //       path: '/form/step-form',
    //       component: './form/step-form',
    //     },
    //     {
    //       name: 'advanced-form',
    //       icon: 'smile',
    //       path: '/form/advanced-form',
    //       component: './form/advanced-form',
    //     },
    //   ],
    // },
    // {
    //   path: '/list',
    //   icon: 'table',
    //   name: 'list',
    //   routes: [
    //     {
    //       path: '/list/search',
    //       name: 'search-list',
    //       component: './list/search',
    //       routes: [
    //         {
    //           path: '/list/search',
    //           redirect: '/list/search/articles',
    //         },
    //         {
    //           name: 'articles',
    //           icon: 'smile',
    //           path: '/list/search/articles',
    //           component: './list/search/articles',
    //         },
    //         {
    //           name: 'projects',
    //           icon: 'smile',
    //           path: '/list/search/projects',
    //           component: './list/search/projects',
    //         },
    //         {
    //           name: 'applications',
    //           icon: 'smile',
    //           path: '/list/search/applications',
    //           component: './list/search/applications',
    //         },
    //       ],
    //     },
    //     {
    //       path: '/list',
    //       redirect: '/list/table-list',
    //     },
    //     {
    //       name: 'table-list',
    //       icon: 'smile',
    //       path: '/list/table-list',
    //       component: './list/table-list',
    //     },
    //     {
    //       name: 'basic-list',
    //       icon: 'smile',
    //       path: '/list/basic-list',
    //       component: './list/basic-list',
    //     },
    //     {
    //       name: 'card-list',
    //       icon: 'smile',
    //       path: '/list/card-list',
    //       component: './list/card-list',
    //     },
    //   ],
    // },
    // {
    //   path: '/profile',
    //   name: 'profile',
    //   icon: 'profile',
    //   routes: [
    //     {
    //       path: '/profile',
    //       redirect: '/profile/basic',
    //     },
    //     {
    //       name: 'basic',
    //       icon: 'smile',
    //       path: '/profile/basic',
    //       component: './profile/basic',
    //     },
    //     {
    //       name: 'advanced',
    //       icon: 'smile',
    //       path: '/profile/advanced',
    //       component: './profile/advanced',
    //     },
    //   ],
    // },
    // {
    //   name: 'result',
    //   icon: 'CheckCircleOutlined',
    //   path: '/result',
    //   routes: [
    //     {
    //       path: '/result',
    //       redirect: '/result/success',
    //     },
    //     {
    //       name: 'success',
    //       icon: 'smile',
    //       path: '/result/success',
    //       component: './result/success',
    //     },
    //     {
    //       name: 'fail',
    //       icon: 'smile',
    //       path: '/result/fail',
    //       component: './result/fail',
    //     },
    //   ],
    // },
    // {
    //   name: 'exception',
    //   icon: 'warning',
    //   path: '/exception',
    //   routes: [
    //     {
    //       path: '/exception',
    //       redirect: '/exception/403',
    //     },
    //     {
    //       name: '403',
    //       icon: 'smile',
    //       path: '/exception/403',
    //       component: './exception/403',
    //     },
    //     {
    //       name: '404',
    //       icon: 'smile',
    //       path: '/exception/404',
    //       component: './exception/404',
    //     },
    //     {
    //       name: '500',
    //       icon: 'smile',
    //       path: '/exception/500',
    //       component: './exception/500',
    //     },
    //   ],
    // },
    // {
    //   name: 'account',
    //   icon: 'user',
    //   path: '/account',
    //   routes: [
    //     {
    //       path: '/account',
    //       redirect: '/account/center',
    //     },
    //     {
    //       name: 'center',
    //       icon: 'smile',
    //       path: '/account/center',
    //       component: './account/center',
    //     },
    //     {
    //       name: 'settings',
    //       icon: 'smile',
    //       path: '/account/settings',
    //       component: './account/settings',
    //     },
    //   ],
    // },
    // {
    //   name: 'editor',
    //   icon: 'highlight',
    //   path: '/editor',
    //   routes: [
    //     {
    //       path: '/editor',
    //       redirect: '/editor/flow',
    //     },
    //     {
    //       name: 'flow',
    //       icon: 'smile',
    //       path: '/editor/flow',
    //       component: './editor/flow',
    //     },
    //     {
    //       name: 'mind',
    //       icon: 'smile',
    //       path: '/editor/mind',
    //       component: './editor/mind',
    //     },
    //     {
    //       name: 'koni',
    //       icon: 'smile',
    //       path: '/editor/koni',
    //       component: './editor/koni',
    //     },
    //   ],
    // },
    // {
    //   path: '/',
    //   redirect: '/dashboard/analysis',
    // },
    {
      component: '404',
    },
  ],
  access: {},
  // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  theme: {
    // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
    // 只有设置为 variable， 才能使用 configProvide 动态设置主色调
    // https://ant.design/docs/react/customize-theme-variable-cn
    'root-entry-name': 'variable',
  },
  // esbuild is father build tools
  // https://umijs.org/plugins/plugin-esbuild
  esbuild: {},
  title: false,
  ignoreMomentLocale: true,
  proxy: proxyConfig[REACT_APP_ENV ?? 'dev'],
  manifest: {
    basePath: '/',
  },
  // Fast Refresh 热更新
  fastRefresh: {},
  openAPI: [
    {
      requestLibPath: "import { request } from 'umi'",
      // 或者使用在线的版本
      // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
      schemaPath: join(__dirname, 'oneapi.json'),
      mock: false,
    },
    {
      requestLibPath: "import { request } from 'umi'",
      schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
      projectName: 'swagger',
    },
  ],
  nodeModulesTransform: {
    type: 'none',
  },
  webpack5: {},
  exportStatic: {},
});
